home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_towergates.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  180 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shs_TowerGates.cog     Make the gates btwn the towers open/close.  
  4. #
  5. # [JWC, RD]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message     activated
  14.  
  15. keyframe    indypull=in_pull_lever.key            local
  16. keyframe    indypush=in_activate_medium.key        local
  17. keyframe    leverDown=gen_lever_pull.key        local
  18.  
  19. sound        leverPull=nub_lever_pull_c.wav    local
  20. sound        leverBack=nub_lever_reset_c.wav    local
  21. sound        gateStart=shw_grill_start.wav     local
  22.  
  23. thing        player        local
  24. thing        indy        nolink
  25. thing        in_mk1
  26. thing        gatecam_1
  27. thing        gatecam_2
  28. thing        gateLever
  29. thing        CT_gate                              
  30. thing       BT_gate
  31. thing        gc_target1            # Indy        
  32. thing        gc_target2             # Gate
  33.  
  34. int            curCam                local
  35. int            in_rotRate            local
  36. int            filter=0            local    
  37.  
  38. cog            NoWorkTalkCog
  39.  
  40. # SUB-ROUTINES
  41. flex         pullLever            local
  42. flex        gate                local
  43. flex        control                local
  44.  
  45. end
  46.  
  47. # ========================================================================================
  48.  
  49. code
  50.  
  51.  
  52. activated:
  53.    
  54.     if (GetSenderRef() != gateLever) return;
  55.     
  56.     # Prep for cutscene...
  57.     SetActorFlags(player, 0x200000);    # paralyze him
  58.     StartCutscene(1);
  59.     curCam = GetCurrentCamera();        
  60.     player = GetLocalPlayerThing();
  61.     
  62.     # Disable and hide player...
  63.     StopThing(player);                    # right now
  64.     PlayMode(player, 1, 0);                # get him into a nice stand
  65.     DeselectWeapon(player);                # stow any weapon or lighter
  66.     CopyPlayerHolsters(player, indy);    # make sure our actor has matching props
  67.     Sleep(0.5);                            # give him some time to do his stuff
  68.     
  69.     # Prep camera & cut...
  70.     SetCameraLookInterp(2, 0);            # kill pan & tilt to lock on 2nd target
  71.     SetCameraPosInterp(2, 0);            # kill dolly mode too
  72.     SetCameraFocus(2, gatecam_1);
  73.     SetCameraSecondaryFocus(2, gc_target1);
  74.     Sleep(0.01);
  75.     SetCurrentCamera(2);
  76.     ResetCameraFOV(0, 0.0);
  77.  
  78.     # Switch actor indy for player...
  79.     TeleportThing(indy, in_mk1);
  80.     SetThingFlags(player, 0x80000);        # hide him
  81.     ClearThingFlags(indy, 0x80000);        # reveal our actor
  82.  
  83.     if (global3 == 0)
  84.     {
  85.         # Indy pulls lever
  86.         PlayKey(indy, indyPull, 4, 0x12, 0);
  87.         PlayKey(gateLever, leverDown, 4, 0x12, 0);
  88.         Sleep(1.2);
  89.         PlaySoundLocal(leverPull, 1.0, 0, 0x0000, 0);
  90.         Sleep(1.4);
  91.         PlaySoundLocal(leverBack, 1.0, 0, 0x0000, 0);
  92.         Sleep(0.3);
  93.  
  94.         # Call NoWorkTalkCog
  95.         SendMessageEx(NoWorkTalkCog, user1, indy, 0, 0, 0);
  96.         global15 = 0; # per Randy
  97.         while (global15 == 0)
  98.         {
  99.             Sleep(0.01); # wait for line to finish
  100.         }
  101.     }
  102.     
  103.     if ((global3 == 1) && (filter == 0))
  104.     { 
  105.         filter = 1;
  106.         Call pullLever;          
  107.          Call gate;
  108.         filter = 0;
  109.     }
  110.     Call control;
  111.     return;
  112.  
  113.  
  114.     
  115. pullLever:
  116.     
  117.     # Indy pulls lever
  118.     PlayKey(indy, indyPull, 4, 0x12, 0);
  119.     PlayKey(gateLever, leverDown, 4, 0x12, 0);
  120.     Sleep(1.2);
  121.     PlaySoundLocal(leverPull, 1.0, 0, 0x0000, 0);
  122.     Sleep(1.4);
  123.     PlaySoundLocal(leverBack, 1.0, 0, 0x0000, 0);
  124.     Sleep(0.3);
  125.     
  126.     PlaySoundLocal(gateStart, 1.0, 0, 0x0000, 0);
  127.     Sleep(0.3);
  128.     
  129.     # Have Indy look up
  130.     in_rotRate = GetThingMaxRotVel(indy);     # remember Indy rate
  131.     SetThingMaxRotVel(indy, 25.0);
  132.     AISetLookThing(indy,gc_target2);
  133.     
  134.  
  135.     # Camera move to show gate
  136.     SetCameraLookInterp(2, 1);            # enable pan & tilt to lock on 2nd target
  137.     SetCameraPosInterp(2, 1);            # enable dolly mode 
  138.     SetCameraInterpSpeed(2, 3.5);        # slow down    pan
  139.     Sleep(0.01);
  140.     SetCameraFocus(2, gatecam_2);        # switch cameras
  141.     SetCameraSecondaryFocus(2, gc_target2);    # look at gate
  142.     SetCurrentCamera(2);
  143.     Sleep(3.0);
  144.     return;
  145.  
  146.    
  147. gate:    
  148.     # Moves gate    
  149.     MoveToFrame(CT_gate, (1-GetCurFrame(CT_gate)), 1);    #"Reed"uction of code
  150.     Sleep(.5);
  151.     MoveToFrame(BT_gate, (1-GetCurFrame(CT_gate)), 1);
  152.     WaitForStop(BT_gate);
  153.     Sleep(.5);    # pause before changing camera
  154.     return;
  155.     
  156.  
  157. control:
  158.        
  159.     # Return control and camera to player
  160.     SetThingMaxRotVel(indy, in_rotRate);# reset indy rotate velocity
  161.     TeleportThing(indy, in_mk1);        # reset actor to original position
  162.     SetActorHeadPYR(indy,'0,0,0');        # reset actor head
  163.     SetThingFlags(indy, 0x80000);
  164.     SetCameraPosition(1, GetThingPos(gatecam_1));    # prep for camera to swing back
  165.     ClearThingFlags(player, 0x80000);
  166.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  167.     SetCameraPosInterp(2, 0); # kill dolly mode
  168.     Sleep(0.01);
  169.     SetCurrentCamera(curCam);
  170.     ResetCameraFOV(0, 0.0);
  171.     EndCutscene();
  172.     ClearActorFlags(player, 0x200000);
  173.     
  174.     return; 
  175.  
  176.  
  177. end
  178.     
  179.     
  180.